<?php $this->load->view('backend/include/modal_header')?>

<?php if ($selector == selector_replace('.inner-content')):?>
	<?php if ($operate == 'edit'):?>
	<script>
	$(document).ready(function() {
		My_widget.sortable.sortable_widget({
			editable: true,
			trash: true,
			inject_param: 'course_weight',
			type: 'text',
		});
	});
    </script>
	<div class="modal-body">
		<div class="sortable-widget">
			<div class="sortable">
				<ul>
					<?php foreach ($course as $v):?>
					<li id="<?php echo $v['id']?>">
						<div><?php echo $v['name']?></div>
						<i class="icon-move"></i>
					</li>
					<?php endforeach;?>
				</ul>
			</div>
			<div class="trash">
			<i class="icon-trash"></i> <b>垃圾箱</b>
			</div>
		</div>
	</div>
	<?php endif;?>
<?php elseif ($selector == selector_replace('#media_carousel .viewport .news > img')):?>
	<?php if ($operate == 'edit'):?>
	<script>
	$(function() {
		var src_path = '<?php echo $pic['thumb_path']?>';
		var width = <?php echo $selector_data['detail']['width']?>;
		var height = <?php echo $selector_data['detail']['height']?>;
		My_widget.upload.upload_widget({ src_path: src_path, width: width, height: height });
	});
    </script>
	<div class="modal-body">
	</div>
	<?php endif;?>
<?php elseif ($selector == selector_replace('.inner-content .courses')):?>
	<?php if ($operate == 'edit'):?>
	<script>
	$(function() {
        editor = CKEDITOR.replace('content_textarea', { toolbar : 'MyToolbar', height: 265 });
	});
    </script>
	<div class="modal-body">
		<form>
		<input type="hidden" id="id" name="id" value="<?php echo $course['id']?>">
			<ul>
				<li>
					<label>标题</label>
					<input type="text" id="name" name="name" value="<?php echo $course['name']?>">
				</li>
				<li>
					<label>副标题</label>
					<input type="text" id="sub_title" name="sub_title" value="<?php echo $course['sub_title']?>">
				</li>
				<li>
					<label>主讲教师</label>
					<input type="text" id="teacher" name="teacher" value="<?php echo $course['teacher']?>">
				</li>
				<li>
					<label>课程目的</label>
					<textarea id="content_textarea"><?php echo $course['content']?></textarea>
				</li>
			</ul>
		</form>
	</div>
	<?php endif;?>
<?php elseif ($selector == selector_replace('#course_modal #gallery')):?>
	<?php if ($operate == 'create'):?>
	<script>
	$(function() {
		var width = <?php echo $selector_data['detail']['width']?>;
		var height = <?php echo $selector_data['detail']['height']?>;
		My_widget.upload.upload_widget({ width: width, height: height });
	});
    </script>
	<div class="modal-body">
	</div>
	<?php elseif ($operate == 'edit'):?>
	<script>
	$(document).ready(function() {
		var width = <?php echo $selector_data['detail']['width']?>;
		var height = <?php echo $selector_data['detail']['height']?>;
		My_widget.sortable.sortable_widget({
			trash: true,
			inject_param: 'course_pic_weight',
			type: 'image',
			width: width,
			height: height,
			resize_times: 3
		});
	});
    </script>
	<div class="modal-body">
		<div class="sortable-widget">
			<div class="sortable">
				<ul>
					<?php foreach ($pic as $v):?>
					<li id="<?php echo $v['id']?>">
						<img src="<?php echo $v['photo_path']?>">
						<i class="icon-move"></i>
					</li>
					<?php endforeach;?>
				</ul>
			</div>
			<div class="trash">
			<i class="icon-trash"></i> <b>垃圾箱</b>
			</div>
		</div>
	</div>
	<?php endif;?>
<?php endif;?>

<?php $this->load->view('backend/include/modal_footer')?>